<?php
echo $this->session->flash();
if (!empty($serviceUnitData)) {
    $this->Paginator->options(array(
        'update' => '#divUpdate',
        'evalScripts' => true,
    ));
}
?>
<div class="file" id="List">
    <table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="#686550">
        <tr class="heading"  bgcolor="#708089">
            <td width="6%" valign="top" align="left"><?php __('S.NO') ?></td>
            <td valign="top" width="30%" align="left"><?php echo $this->Paginator->sort('unit_name', __('UNIT_NAME', true)); ?></td>
            <td valign="top" width="30%" align="left"><?php echo $this->Paginator->sort('unit_code', __('UNIT_CODE', true)); ?></td>
            <td valign="top" width="30%" align ="left"><?php echo $this->Paginator->sort('created', __('CREATED', true)); ?></td>
        </tr>
        <?php
        if (isset($serviceUnitData) && count($serviceUnitData) > 0) {
            $i = 0;
            foreach ($serviceUnitData as $arrayDetail) {
                ?>
                <tr class="heading2" bgcolor="#ffffff">
                    <td>&nbsp;<?php echo $i + 1 ?></td>
                    <td>&nbsp;<?php echo $arrayDetail['ServiceUnit']['unit_name'] ?></td>
                    <td>&nbsp;<?php echo $arrayDetail['ServiceUnit']['unit_code'] ?></td>
                    <td>&nbsp;<?php echo date('M j, Y', strtotime($arrayDetail['ServiceUnit']['created'])); ?></td>
                </tr>  
                <?php
                $i++;
            }
        }
        ?>
        <tr>
            <td colspan="4" bgcolor="#ffffff" align="center">
                <div class="pagination">            
                    <?php
                    if (!empty($serviceUnitData)) {

                        echo $this->Element('pagination');
                    } else {
                        echo __("NO_RECORD_MESSAGE");
                    }
                    ?>              
                </div>
            </td>
        </tr>
    </table>
</div>
<?php echo $this->Js->writeBuffer(); ?>